﻿package code
{
	
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.events.KeyboardEvent;
	import flash.geom.Point;
	
	public class map extends MovieClip
	{
		
		private var _barrierKids:Vector.<barrier>;
		public var spawns:Vector.<spawnLine>;
		
		public function map()
		{
			//Create barrier vector
			barrierKids = new Vector.<barrier>
			for (var i:int = 0; i < numChildren; i++)
			{
				if (getChildAt(i) is barrier)
				{
					barrierKids.push(getChildAt(i));
				}
			}
			
			for (var i:int = 0; i < barrierKids.length; i++)
			{
				
				for (var t:int = 0; t < 4; t++)
				{
					var tempPoint = new Point();
					if (t % 2 == 0)
					{
						tempPoint.x = barrierKids[i].x;
					}
					else
					{
						tempPoint.x = barrierKids[i].x + width;
					}
					if (t / 2 == 0)
					{
						tempPoint.y = barrierKids[i].y;
					}
					else
					{
						tempPoint.y = barrierKids[i].y + height;
					}
					barrierKids[i].points.push(tempPoint);
				}
				
			}
		
		}
		
		public function get barrierKids():Vector.<barrier>
		{
			return _barrierKids;
		}
	}

}
